package cn.bin758.h5game.module.game.dal.mysql.GameData;

import java.util.*;

import cn.bin758.h5game.framework.common.pojo.PageResult;
import cn.bin758.h5game.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.bin758.h5game.framework.mybatis.core.mapper.BaseMapperX;
import cn.bin758.h5game.module.game.dal.dataobject.GameData.GameDataDO;
import org.apache.ibatis.annotations.Mapper;
import cn.bin758.h5game.module.game.controller.admin.GameData.vo.*;

/**
 * 游戏数据 Mapper
 *
 * @author bin758
 */
@Mapper
public interface GameDataMapper extends BaseMapperX<GameDataDO> {

    default PageResult<GameDataDO> selectPage(GameDataPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<GameDataDO>()
                .eqIfPresent(GameDataDO::getId, reqVO.getId())
                .betweenIfPresent(GameDataDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(GameDataDO::getId));
    }

    default List<GameDataDO> selectList(GameDataExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<GameDataDO>()
                .eqIfPresent(GameDataDO::getId, reqVO.getId())
                .betweenIfPresent(GameDataDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(GameDataDO::getId));
    }

}
